<?php
	if(!defined("IN_APP"))
	{
		exit;
	}
	
	if(!adminpermission('Z','100000'))
	{
		echo '无权查看!';
		exit;
	}
	
	$sqlTools = new _SqlTool();
	
	$fTitle = "资源管理";
	$sTitle = "投资攻略列表";
	
	$parm = requestArrayParm($_REQUEST);
	
	if($parm['m'] == 'list')
	{
		$search = array();
		
		if($parm['start'] && $parm['end'])
		{
			$between['start'] = strtotime($parm['start']);
			
			$between['end'] = strtotime($parm['end']);
		}
		
		if($parm['status'])
		{
			$search['status'] = $parm['status'];
		}
		
		$page = $pages['page'] = getParam('page','request','1');
		
		$pages['rows'] = 20;
		
		$resData = _SqlTool::getOplogList('touzi', $search, $pages,array() ,$between);
		//查询对应的数据
		
		foreach ($resData['list']  as $key => $value)
		{
			$value['opinfo'] = _OpLog::getLastOpLog(array('table'=>'touzi','union_id'=>$value['id']));
			$list[] = $value;
		}
		
		$pageurl = SITE_URL.'admin.php?'.set_URL_Param(get_URL_Param());
	
		$pagetotal = $resData["pages"];
		
		include renderTemplate('gongxiang/tzlist');
	}
	
	if($method == 'add')
	{
		$pagetitle = '创建投资攻略信息';
		include renderTemplate('gongxiang/tzinfo');
	}
	
	if($method == 'edit')
	{
		$pagetitle = '编辑投资攻略信息';
		if(!empty($parm['id']))
		{
			unset($wheres);
			$wheres['id'] = $parm['id'];
			$touzi = _SqlTool::getInfo('touzi', $wheres);
			include renderTemplate('gongxiang/tzinfo');
		}
		
	}